home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17797 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: galaxy.ucr.edu!not-for-mail
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Re: Will Java kill C++?
  5. Followup-To: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  6. Date: 17 Apr 1996 15:52:02 GMT
  7. Organization: University of California, Riverside
  8. Message-ID: <4l3432$ebu@galaxy.ucr.edu>
  9. References: <3134D499.653E@ix.netcom.com> <313613B2.136E@ksopk.sprint.com> <4i7qhl$ik6@cronkite.seas.gwu.edu> <4iuhi7$fmf@sundog.tiac.net> <4iumap$mn5@hustle.rahul.net> <31582A45.3742@vmark.com> <3163C031.4FB1@esec.ch> <3164888D.2B01@concentric.net> <4kbfn8$1bu@news1.is.net> <4kqjf6$kh0@kaiwan009.kaiwan.com> <317173F1.5790@concentric.net> <4l194e$q11@galaxy.ucr.edu> <31743669.62A1@concentric.net>
  10. NNTP-Posting-Host: corvette.ucr.edu
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12.  
  13. Alan L. Lovejoy (alovejoy@concentric.net) wrote:
  14. : Tom Payne wrote:
  15. : > 
  16. : > Alan L. Lovejoy (alovejoy@concentric.net) wrote:
  17. : > :
  18. : > : I did those benchmars to prove that Smalltalk message sends are faster
  19. : > : than c function calls.  To do that, I needed a benchmark that consisted
  20. : > 
  21. : > How is that possible, given that the message has to find the entry
  22. : > point of the method and has to communicate parameters by mechanisms
  23. : > not unavailable to C.
  24. : It's a fact.  It's possible because full method lookup only needs to
  25. : occur the first time a message is sent to a receiver of a particular
  26. : class, not each time a message is sent--and because message sends do not
  27. : use "JSR/BSR" machine instructions, but just use simple jumps or 
  28. : branches.  Remember, method contexts are allocated on the heap, not on
  29. : the stack.  
  30.  
  31. This shows that a particular implementation of Smalltalk message sends
  32. is faster than a particular implementation of C function calls, which
  33. is both surprising and interesting, but does not show message sends to
  34. be inherently faster.  (Perhaps, all you are claiming is the relative
  35. performance in a particular case.)
  36.  
  37. As I recall, the standard trick for eliminating most of the overhead
  38. of method lookups on message sends is to cache the method on each send
  39. and next time check for correctness.  Of course, this correctness
  40. check is overhead that is unnecessary in C.  The fact that in this
  41. implementation method contexts are allocate on the heap, not the
  42. stack, leaves me even more puzzled; heap allocation is no faster, in
  43. fact almost always slower, than stack allocation, which merely
  44. involves incrementing a pointer.
  45.  
  46. Tom Payne (thp@cs.ucr.edu)
  47.